package com.xcx.portal.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.xcx.common.services.CalculatorService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 计算器controller
 *
 * @author yangjun
 * @date 2018年7月13日 下午8:32:17
 */
@RestController
@RequestMapping(value = "/xcx/calculator")
public class CalculatorController {

    @Reference
    private CalculatorService calculatorService;

    /**
     * 用户登录
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/userLogin", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String userLogin(@RequestBody String reqStr) {
        return calculatorService.userLogin(reqStr);
    }

    /**
     * 查询用户是否绑定
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/queryUserBinding", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String queryUserBinding(@RequestBody String reqStr) {
        return calculatorService.queryUserBinding(reqStr);
    }

    /**
     * 保存用户信息
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/saveUserInfo", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String saveUserInfo(@RequestBody String reqStr) {
        return calculatorService.saveUserInfo(reqStr);
    }

    /**
     * 查询用户计算器设置
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/queryUserCalcuSet", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String queryUserCalcuSet(@RequestBody String reqStr) {
        return calculatorService.queryUserCalcuSet(reqStr);
    }

    /**
     * 查询用户计算器皮肤
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/queryUserCalcuSkin", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String queryUserCalcuSkin(@RequestBody String reqStr) {
        return calculatorService.queryUserCalcuSkin(reqStr);
    }

    /**
     * 查询计算器皮肤列表
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/queryCalcuSkinList", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String queryCalcuSkinList(@RequestBody String reqStr) {
        return calculatorService.queryCalcuSkinList(reqStr);
    }

    /**
     * 更换计算器皮肤
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/updateCalcuSkin", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String updateCalcuSkin(@RequestBody String reqStr) {
        return calculatorService.updateCalcuSkin(reqStr);
    }


    /**
     * 查询用户是否解锁
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/queryUserUnlock", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String queryUserUnlock(@RequestBody String reqStr) {
        return calculatorService.queryUserUnlock(reqStr);
    }


    /**
     * 保存更新用户分享次数
     *
     * @param reqStr
     * @return
     */
    @RequestMapping(value = "/updateUserShare", produces = {"application/json;chart=UTF-8"})
    @ResponseBody
    public String updateUserShare(@RequestBody String reqStr) {
        return calculatorService.updateUserShare(reqStr);
    }



}
